cmake_minimum_required(VERSION 3.10)

project(psacyber)

# 将C++标准从11更新为17以支持现代C++特性
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

add_library(psacyber SHARED libpsacyber.cpp)

target_include_directories(psacyber PUBLIC 
    ${PROJECT_SOURCE_DIR}
)

target_link_libraries(psacyber cybersecurity crypto teec pthread)

# 添加test子目录以解决依赖问题
add_subdirectory(test)

# 添加安装指令，将setup.sh安装到build目录
install(PROGRAMS ${CMAKE_SOURCE_DIR}/setup.sh
        DESTINATION ${CMAKE_BINARY_DIR}
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install(TARGETS psacyber
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
)
install(DIRECTORY . DESTINATION include/psacyber
    FILES_MATCHING PATTERN "*.h"
)